package com.cf;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * boot-cloud-ConsumerApp
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/7/20 上午 11:58
 */

@EnableFeignClients("com.cf")
@EnableDiscoveryClient
@SpringBootApplication
public class GoodApp implements InitializingBean {


    @Autowired
    private FreeMarkerProperties freeMarkerProperties;

    @Override
    public void afterPropertiesSet() throws Exception {
        String[] templateLoaderPath = freeMarkerProperties.getTemplateLoaderPath();
        ArrayList<String> paths = new ArrayList();
        paths.addAll(Arrays.asList(templateLoaderPath));
        paths.add("classpath:/template-good/");
        String[] strings = paths.toArray(new String[paths.size()]);
        freeMarkerProperties.setTemplateLoaderPath(strings);
    }

    public static void main(String[] args) {
        new SpringApplicationBuilder(GoodApp.class).web(true).run(args);
    }

}